//
//  LOLlikeandTableViewCell.m
//  LOLXXbox
//
//  Created by mac on 16/2/27.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLlikeandTableViewCell.h"
#import "LOLFitCellHeight.h"
#define WIDTH [[UIScreen mainScreen]bounds].size.width
@implementation LOLlikeandTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        
        
        self.namelabel=[[UILabel alloc]init];
        self.namelabel.font=[UIFont systemFontOfSize:16];
        self.namelabel.textColor=[UIColor colorWithRed:0.254 green:0.822 blue:1.000 alpha:0.750];
        [self.contentView addSubview:self.namelabel];

        
        self.heroImageView1=[[UIImageView alloc]init];
        self.heroImageView1.userInteractionEnabled=YES;
        [self.contentView addSubview:self.heroImageView1];

        
        UITapGestureRecognizer *tap1=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pushToDetailPage1:)];
        tap1.numberOfTapsRequired=1;
        tap1.numberOfTouchesRequired=1;
        [self.heroImageView1 addGestureRecognizer:tap1];

        
        
        
        self.heroDetailLabel1=[[UILabel alloc]init];
        self.heroDetailLabel1.font=[UIFont systemFontOfSize:15];
        self.heroDetailLabel1.numberOfLines=0;
        [self.heroDetailLabel1 sizeToFit];
        [self.contentView addSubview:self.heroDetailLabel1];

        
        
        self.heroImageView2=[[UIImageView alloc]init];
        self.heroImageView2.userInteractionEnabled=YES;
        [self.contentView addSubview:self.heroImageView2];

        UITapGestureRecognizer *tap2=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pushToDetailPage2:)];
        tap2.numberOfTapsRequired=1;
        tap2.numberOfTouchesRequired=1;
        [self.heroImageView2 addGestureRecognizer:tap2];

        
        
        
        self.heroDetailLabel2 = [[UILabel alloc]init];
        self.heroDetailLabel2.font = [UIFont systemFontOfSize:15];
        self.heroDetailLabel2.numberOfLines=0;
        [self.heroDetailLabel2 sizeToFit];
        [self.contentView addSubview:self.heroDetailLabel2];

        
        
        
    }
    
    
    return self;
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.namelabel.frame=CGRectMake(10, 0, WIDTH-20, 30);
    self.heroImageView1.frame=CGRectMake(10, 40, 64, 64);
    CGFloat temp= [LOLFitCellHeight computeLabelCellLabel:self.heroDetailLabel1 fontSize:15 frame:CGRectMake(80, 40, WIDTH-90, 0)];
    CGFloat height = temp>64?temp:64;
    self.heroImageView2.frame=CGRectMake(10, 50+height, 64, 64);
    
    [LOLFitCellHeight computeLabelCellLabel:self.heroDetailLabel2 fontSize:15 frame:CGRectMake(80, 50+height, WIDTH-90, 0)];
    
    
    
    
}
-(void)pushToDetailPage1:(UIPanGestureRecognizer *)action
{
    ;
    NSDictionary *dic=@{@"enName":self.heroArr[0][@"partner"]};
    [[NSNotificationCenter defaultCenter] postNotificationName:@"enName" object:nil userInfo:dic];
    
    
}
-(void)pushToDetailPage2:(UIPanGestureRecognizer *)action
{
    ;
    NSDictionary *dic=@{@"enName":self.heroArr[1][@"partner"]};
    [[NSNotificationCenter defaultCenter] postNotificationName:@"enName" object:nil userInfo:dic];
    
    
}


@end
